import React from 'react';
import { Card, Table, Button, Space, Tag } from 'antd';
import { UserOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';

/**
 * 用户管理页面
 * 展示用户列表和管理功能
 */
const UserManagement: React.FC<React.PropsWithChildren<unknown>> = () => {
  // 模拟用户数据
  const userData = [
    {
      key: '1',
      name: '张三',
      email: 'zhangsan@example.com',
      department: '技术部',
      status: 'active',
    },
    {
      key: '2',
      name: '李四',
      email: 'lisi@example.com',
      department: '市场部',
      status: 'active',
    },
    {
      key: '3',
      name: '王五',
      email: 'wangwu@example.com',
      department: '财务部',
      status: 'inactive',
    },
  ];

  const columns = [
    {
      title: '姓名',
      dataIndex: 'name',
      key: 'name',
    },
    {
      title: '邮箱',
      dataIndex: 'email',
      key: 'email',
    },
    {
      title: '部门',
      dataIndex: 'department',
      key: 'department',
    },
    {
      title: '状态',
      dataIndex: 'status',
      key: 'status',
      render: (status: string) => (
        <Tag color={status === 'active' ? 'green' : 'red'}>
          {status === 'active' ? '活跃' : '禁用'}
        </Tag>
      ),
    },
    {
      title: '操作',
      key: 'action',
      render: () => (
        <Space size="middle">
          <Button type="link" icon={<EditOutlined />} size="small">
            编辑
          </Button>
          <Button type="link" danger icon={<DeleteOutlined />} size="small">
            删除
          </Button>
        </Space>
      ),
    },
  ];

  return (
    <div>
      <Card>
        <Table columns={columns} dataSource={userData} pagination={false} />
      </Card>
    </div>
  );
};

export default UserManagement;